<h1 id="plugins" class="title-1">Please Plugins</h1>

<p>
    Plugins are a way to extend Please with build rules for additional languages or technologies. The quickest way to get
    started is by running <code class="code">plz init plugin [go|python|java]</code>. The full list of available plugins
    can be found <a href="https://github.com/please-build/please-rules" class="copy-link">here</a>.
</p>
<p>
    Plugins are configured in your <code class="code">.plzconfig</code> file. For example, to load the
    <code class="code">python</code> plugin, add the following to your <code class="code">.plzconfig</code> file:
</p>

<pre class="code-container">
    <!-- prettier-ignore -->
    <code class="language-config">
    [Plugin "python"]
    Target = //plugins:python
    DefaultInterpreter = python3 # Optional config
    </code>
</pre>

<p>
    Where <code class="code">Target = //plugins:python</code> is the <code class="code">plugin_repo()</code> target for your plugin. For example:
</p>

<pre class="code-container">
<!-- prettier-ignore -->
    <code class="language-python">
    plugin_repo(
        name = "python",
        revision = "v0.1.0",
    )
    </code>
</pre>

<p>
There are some first-class plugins that are supported and maintained by the Please team. These are listed below.
</p>

{{ range $plugin := . }}
<section class="mt4">
    <h1 class="title-1" id="{{$plugin.Name}}">
        {{formatName $plugin.Name}} rules
    </h1>
    <p>
        {{$plugin.Help}}
    </p>
    {{ range $key, $_ := $plugin.Rules.Functions }}
    {{ template "lexicon_entry.html" $plugin.Rules.Named $key }}
    {{end}}
    <h2 id="please" class="title-2">[Plugin "{{$plugin.Name}}"]</h2>
    <ul class="bulleted-list">
        {{ range $_, $field := $plugin.Config }}

        <li>
            <div>
                <h3 class="mt1 f6 lh-title" id="{{$plugin.Name}}}.{{$field.Name}}">
                    {{$field.Name}} ({{if $field.Repeatable}}repeatable {{end}}{{if $field.Optional}}optional {{end}}{{$field.Type}})
                </h3>
                <p>
                    {{$field.Help}}
                </p>
                {{if $field.Inherit}}
                <p>
                    If set, {{$field.Name}} is inherited from the host repo.
                </p>
                {{end}}
                {{if $field.DefaultValue}}
                <p>
                    Defaults to <code class="code">{{$field.DefaultValue}}</code>
                </p>
                {{end}}
            </div>
        </li>
        {{end}}
    </ul>
</section>
{{ end }}